<script setup>
import { ref } from 'vue'
import { useRouter } from 'vue-router'

const router = useRouter()

const features = ref([
  {
    icon: '🎯',
    title: '智能匹配',
    description: '基于您的健身目标、预算和地理位置，为您推荐最合适的私教',
    action: () => router.push('/matching')
  },
  {
    icon: '👨‍💼',
    title: '专业私教库',
    description: '汇聚全城优质私教，支持多维度筛选和详细资质查看',
    action: () => router.push('/trainers')
  },
  {
    icon: '📅',
    title: '便捷预约',
    description: '可视化日历预约，支持单次课程、课程包等多种付费模式',
    action: () => router.push('/booking')
  },
  {
    icon: '⭐',
    title: '质量保障',
    description: '完善的评价体系和训练效果追踪，确保教学质量',
    action: () => router.push('/profile')
  }
])

const stats = ref([
  { number: '1000+', label: '认证私教' },
  { number: '50000+', label: '成功匹配' },
  { number: '98%', label: '用户满意度' },
  { number: '30+', label: '覆盖城市' }
])
</script>

<template>
  <div class="home-page">
    <!-- Hero Section -->
    <section class="hero-section">
      <div class="page-container">
        <div class="hero-content">
          <div class="hero-text">
            <h1 class="hero-title">找到最适合您的健身私教</h1>
            <p class="hero-subtitle">
              专业的私教匹配平台，让健身更科学、更高效、更安全
            </p>
            <div class="hero-actions">
              <button class="btn btn-primary" @click="router.push('/matching')">
                开始匹配
              </button>
              <button class="btn btn-secondary" @click="router.push('/trainers')">
                浏览私教
              </button>
            </div>
          </div>
          <div class="hero-image">
            <div class="hero-visual">
              <div class="visual-element">💪</div>
              <div class="visual-element">🎯</div>
              <div class="visual-element">⭐</div>
            </div>
          </div>
        </div>
      </div>
    </section>

    <!-- Features Section -->
    <section class="features-section">
      <div class="page-container">
        <h2 class="section-title">核心功能</h2>
        <div class="desktop-grid-4">
          <div 
            v-for="feature in features" 
            :key="feature.title"
            class="feature-card"
            @click="feature.action"
          >
            <div class="feature-icon">{{ feature.icon }}</div>
            <h3 class="feature-title">{{ feature.title }}</h3>
            <p class="feature-description">{{ feature.description }}</p>
          </div>
        </div>
      </div>
    </section>

    <!-- Stats Section -->
    <section class="stats-section">
      <div class="page-container">
        <h2 class="section-title">平台数据</h2>
        <div class="desktop-grid-4">
          <div v-for="stat in stats" :key="stat.label" class="stat-card">
            <div class="stat-number">{{ stat.number }}</div>
            <div class="stat-label">{{ stat.label }}</div>
          </div>
        </div>
      </div>
    </section>

    <!-- CTA Section -->
    <section class="cta-section">
      <div class="page-container">
        <div class="cta-content">
          <h2 class="cta-title">开始您的健身之旅</h2>
          <p class="cta-subtitle">立即注册，找到最适合您的私人教练</p>
          <button class="btn btn-primary btn-large" @click="router.push('/matching')">
            免费开始匹配
          </button>
        </div>
      </div>
    </section>
  </div>
</template>

<style scoped>
.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 20px;
}

/* Hero Section */
.hero-section {
  background: linear-gradient(135deg, #0f0f23 0%, #1a1a2e 30%, #16213e 60%, #0f3460 100%);
  color: white;
  padding: 8rem 0;
  min-height: 70vh;
  display: flex;
  align-items: center;
  position: relative;
  overflow: hidden;
}

.hero-section::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: 
    radial-gradient(circle at 20% 80%, rgba(0, 255, 255, 0.1) 0%, transparent 50%),
    radial-gradient(circle at 80% 20%, rgba(255, 0, 255, 0.1) 0%, transparent 50%),
    radial-gradient(circle at 40% 40%, rgba(0, 255, 0, 0.05) 0%, transparent 50%);
  animation: backgroundShift 8s ease-in-out infinite;
}

@keyframes backgroundShift {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.7; }
}

.hero-content {
  display: grid;
  grid-template-columns: 1.2fr 0.8fr;
  gap: 6rem;
  align-items: center;
  width: 100%;
  position: relative;
  z-index: 2;
}

.hero-text {
  text-align: left;
}

.hero-title {
  font-size: 4rem;
  font-weight: 700;
  margin-bottom: 2rem;
  line-height: 1.2;
}

.hero-subtitle {
  font-size: 1.4rem;
  margin-bottom: 3rem;
  opacity: 0.9;
  line-height: 1.6;
}

.hero-actions {
  display: flex;
  gap: 1.5rem;
  justify-content: flex-start;
}

.hero-image {
  display: flex;
  justify-content: center;
  align-items: center;
}

.hero-visual {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 2rem;
  padding: 3rem;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 20px;
  backdrop-filter: blur(10px);
}

.visual-element {
  font-size: 4rem;
  text-align: center;
  padding: 2rem;
  background: rgba(255, 255, 255, 0.2);
  border-radius: 15px;
  transition: transform 0.3s ease;
}

.visual-element:hover {
  transform: scale(1.1);
}

/* Button Styles */
.btn {
  padding: 0.75rem 1.5rem;
  border: none;
  border-radius: 30px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  text-decoration: none;
  display: inline-block;
  text-align: center;
  position: relative;
  overflow: hidden;
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.2);
}

.btn::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
  transition: left 0.5s;
}

.btn:hover::before {
  left: 100%;
}

.btn-primary {
  background: linear-gradient(135deg, rgba(0, 255, 255, 0.8), rgba(0, 150, 255, 0.8));
  color: white;
  border-color: #00f5ff;
  box-shadow: 0 0 20px rgba(0, 245, 255, 0.3);
  text-shadow: 0 0 10px rgba(0, 245, 255, 0.5);
}

.btn-primary:hover {
  background: linear-gradient(135deg, rgba(0, 255, 255, 1), rgba(0, 150, 255, 1));
  transform: translateY(-3px) scale(1.05);
  box-shadow: 0 10px 30px rgba(0, 245, 255, 0.5);
  text-shadow: 0 0 15px rgba(0, 245, 255, 0.8);
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.1);
  color: white;
  border: 2px solid rgba(255, 0, 255, 0.6);
  box-shadow: 0 0 15px rgba(255, 0, 255, 0.2);
  text-shadow: 0 0 8px rgba(255, 0, 255, 0.4);
}

.btn-secondary:hover {
  background: rgba(255, 0, 255, 0.2);
  border-color: #ff00ff;
  transform: translateY(-3px) scale(1.05);
  box-shadow: 0 10px 25px rgba(255, 0, 255, 0.4);
  text-shadow: 0 0 15px rgba(255, 0, 255, 0.8);
}

.btn-large {
  padding: 1.2rem 2.5rem;
  font-size: 1.2rem;
  border-radius: 35px;
}

/* Features Section */
.features-section {
  padding: 6rem 0;
  background: #f8fafc;
}

.section-title {
  text-align: center;
  font-size: 3rem;
  margin-bottom: 4rem;
  color: #2d3748;
  font-weight: 700;
}

.feature-card {
  background: white;
  padding: 3rem 2rem;
  border-radius: 16px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
  text-align: center;
  transition: all 0.3s ease;
  cursor: pointer;
  border: 1px solid #e2e8f0;
}

.feature-card:hover {
  transform: translateY(-8px);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.15);
  border-color: #667eea;
}

.feature-icon {
  font-size: 4rem;
  margin-bottom: 1.5rem;
  display: block;
}

.feature-title {
  font-size: 1.6rem;
  margin-bottom: 1.5rem;
  color: #2d3748;
  font-weight: 600;
}

.feature-description {
  color: #718096;
  line-height: 1.7;
  font-size: 1rem;
}

/* Stats Section */
.stats-section {
  background: #2d3748;
  color: white;
  padding: 6rem 0;
  text-align: center;
}

.stat-card {
  text-align: center;
  padding: 2rem;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 16px;
  transition: transform 0.3s ease;
}

.stat-card:hover {
  transform: translateY(-5px);
  background: rgba(255, 255, 255, 0.1);
}

.stat-number {
  font-size: 3.5rem;
  font-weight: 700;
  margin-bottom: 1rem;
  color: #667eea;
  display: block;
}

.stat-label {
  font-size: 1.2rem;
  opacity: 0.9;
  font-weight: 500;
}

/* CTA Section */
.cta-section {
  background: linear-gradient(135deg, #f7fafc 0%, #edf2f7 100%);
  padding: 6rem 0;
  text-align: center;
}

.cta-content {
  max-width: 700px;
  margin: 0 auto;
}

.cta-title {
  font-size: 3rem;
  margin-bottom: 1.5rem;
  color: #2d3748;
  font-weight: 700;
}

.cta-subtitle {
  font-size: 1.3rem;
  color: #718096;
  margin-bottom: 3rem;
  line-height: 1.6;
}

/* Responsive Design */
@media (max-width: 1200px) {
  .hero-content {
    gap: 4rem;
  }
  
  .hero-title {
    font-size: 3.5rem;
  }
  
  .visual-element {
    font-size: 3rem;
    padding: 1.5rem;
  }
}

@media (max-width: 768px) {
  .hero-section {
    padding: 4rem 0;
    min-height: auto;
  }
  
  .hero-content {
    grid-template-columns: 1fr;
    gap: 3rem;
    text-align: center;
  }
  
  .hero-text {
    text-align: center;
  }

  .hero-title {
    font-size: 2.5rem;
  }
  
  .hero-subtitle {
    font-size: 1.2rem;
  }

  .hero-actions {
    justify-content: center;
    flex-wrap: wrap;
  }
  
  .hero-visual {
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
    padding: 2rem;
  }
  
  .visual-element {
    font-size: 2rem;
    padding: 1rem;
  }

  .features-section,
  .stats-section,
  .cta-section {
    padding: 4rem 0;
  }

  .section-title {
    font-size: 2.2rem;
    margin-bottom: 3rem;
  }

  .cta-title {
    font-size: 2.2rem;
  }
  
  .stat-number {
    font-size: 2.5rem;
  }
}
</style>
